#include <sigel/ISigel.h> // include engine



sGAME //enter point
{
	Init(800,600,32,2); //initialisation
	AppTitle("3DScene"); //change window title

	VWait(0); //disable vertical synchonize
	Camera eye; //Create camera

	TFont *fnt = new TFont("tahoma.txt"); //load texture font

	Surface *cube_s = new Surface(); //create surface. is void surface.
	cube_s->LoadS3M("box02.s3m"); //create cube into our surface
	cube_s->FitSphere(1);
	//cube_s->Flip();

	//cube_s->UpdateNormals(UN_MESH);

	Entity *cube = new Entity(cube_s); //create instance of our cube (only instances may be visible)
	cube->Position(0,0,-4); //move cube on 0 position X, 0 position Y, and -4 position on Z (its need to visible cube, you may experimence of this value)

	Light *l = new Light(); //create light.
//	Entity *light = new Entity(l); //create instance of light
//	light->Position(-20,30,20); //move light

	Texture *tex = new Texture("texture.jpg",TF_MIPMAP | TF_ANISOTROPIC); //loading texture from file "texture.jpg" 
	//and with flags TF_MIPMAP - for using trilenial filtration and TF_ANISOTROPIC - for using anisotropic filtration
	cube->BindTex(tex,0); //bindint texture to our cube on first uv coords

	Texture *tex2 = new Texture("texture.jpg",TF_MIPMAP | TF_ANISOTROPIC | TF_SPHEREMAP); //loading second texture with spherical deform
	tex2->Blend(TB_ADD); //additional blending for this texture
	cube->BindTex(tex2,1); //bindning to second uv coords (they generated autoamitacl, TF_SPHEREMAP)

	float dt = 0; //delta time, for time sync

	while(!KeyDown(VK_ESCAPE)) //main cycle
	{
		dt = GetFrameTime(); //get cyrrent frame time
		cube->Turn(0.1f * dt,0.2f * dt,0); //turn cube with time scale (0.1 of x axis in 1 ms, and 0.2 of y axis in 1 ms)

		//3d
		Render(); //render
		//2d


		fnt->Text(GetFPS(),10,10); //output fps
		Flip(); //flip screen
	}

	Destroy(); //shutdown engine
};